import {
	request,
} from './config.js'
const loginStatus = uni.getStorageSync('hk_token') ? true : false
/**-----------------用户api-------------------------------------*/
const userApi = {
	// 登录
	http_login(data = {}) {
		data.url = '/api/user.login/we_mini'
		data.wrToken = false
		return request(data)
	},
	// 获取用户信息
	http_userinfo(data = {}) {
		data.url = '/api/user.info/view'
		return request(data)
	},
	// 添加/修改收货地址
	http_userAddress_save(data = {}) {
		data.url = '/api/user.address/save'
		return request(data)
	},
	// 收货地址列表
	http_userAddress_lst(data = {}) {
		data.url = '/api/user.address/lst'
		return request(data)
	},
	// 设为默认地址
	http_useraddress_set_default(data = {}) {
		data.url = '/api/user.address/set_default'
		data.method = 'GET'
		return request(data)
	},
	// 删除收货地址
	http_useraddress_delete(data = {}) {
		data.url = '/api/user.address/delete'
		data.method = 'GET'
		return request(data)
	},
	// 单个收货地址详情
	http_useraddress_view(data = {}) {
		data.url = '/api/user.address/view'
		data.method = 'GET'
		return request(data)
	},
	// 加入购物车
	http_user_shop_cart_add(data = {}) {
		data.url = '/api/user.shop_cart/add'
		return request(data)
	},
	// 获取购物车数量
	http_user_shop_cart_num(data = {}) {
		data.url = '/api/user.shop_cart/num'
		return request(data)
	},
	// 确认订单
	http_userorder_confirm(data = {}) {
		data.url = '/api/user.order/confirm'
		return request(data)
	},
	// 创建订单
	http_userorder_create(data) {
		data.url = '/api/user.order/create'
		return request(data)
	},
	// 获取购物车列表
	http_usershop_cart_lst(data = {}) {
		data.url = '/api/user.shop_cart/lst'
		data.unishow = false
		return request(data)
	},
	// 删除购物车商品
	http_userShop_cart_delete(data = {}) {
		data.url = '/api/user.shop_cart/delete'
		data.method = 'GET'
		return request(data)
	},
	// 订单列表
	http_userorder_lst(data = {}) {
		data.url = '/api/user.order/lst'
		data.method = 'GET'
		return request(data)
	},
	// 订单详情
	http_userOrder_view(data = {}) {
		data.url = '/api/user.order/view'
		data.method = 'GET'
		return request(data)
	},
	// UU跑腿信息
	http_userorderuu_view(data = {}) {
		data.url = '/api/user.order/uu_view'
		data.method = 'GET'
		return request(data)
	},
	// 取消订单
	http_userorder_cancel(data = {}) {
		data.url = '/api/user.order/cancel'
		data.method = 'GET'
		return request(data)
	},
	// 删除订单
	http_userorder_delete(data = {}) {
		data.url = '/api/user.order/delete'
		data.method = 'GET'
		return request(data)
	},
	// 确认收货
	http_userorder_receive(data = {}) {
		data.url = '/api/user.order/receive'
		data.method = 'GET'
		return request(data)
	},
	// 获取售后列表
	http_user_order_refund_after_sale(data = {}) {
		data.url = '/api/user.order_refund/after_sale'
		data.method = 'GET'
		return request(data)
	},
	// 申请退款详情
	http_user_order_refund_app_view(data = {}) {
		data.url = '/api/user.order_refund/app_view'
		data.method = 'GET'
		return request(data)
	},
	// 获取退货原因
	http_user_order_refund_back_order_info(data = {}) {
		data.url = '/api/user.order_refund/back_order_info'
		data.method = 'GET'
		return request(data)
	},
	// 申请退款
	http_user_order_refund_apply(data = {}) {
		data.url = '/api/user.order_refund/apply'
		return request(data)
	},
	// 退款单详情
	http_user_order_refund_view(data = {}) {
		data.url = '/api/user.order_refund/view'
		data.method = 'GET'
		return request(data)
	},
	// 修改申请
	http_user_order_refund_amend(data = {}) {
		data.url = '/api/user.order_refund/amend'
		return request(data)
	},
	// 发起退款申诉
	http_user_order_refund_appeal(data = {}) {
		data.url = '/api/user.order_refund/appeal'
		return request(data)
	},
	http_user_order_refund_cancel_apply(data = {}) {
		data.url = '/api/user.order_refund/cancel_apply'
		data.method = 'GET'
		return request(data)
	},
	// 修改申诉
	http_user_order_refund_amend_appeal(data = {}) {
		data.url = '/api/user.order_refund/amend_appeal'
		return request(data)
	},
	// 取消申诉
	http_user_order_refund_cancel_appeal(data = {}) {
		data.url = '/api/user.order_refund/cancel_appeal'
		data.method = 'GET'
		return request(data)
	},
	// 获取商家快递公司列表
	http_user_order_refund_express_company(data = {}) {
		data.url = '/api/user.order_refund/express_company'
		data.method = 'GET'
		return request(data)
	},
	// 退款发货
	http_user_order_refund_send_out_goods(data = {}) {
		data.url = '/api/user.order_refund/send_out_goods'
		return request(data)
	},
	// 账单 （余额明细）
	http_user_wallet_money_log(data = {}) {
		data.url = '/api/user.wallet/money_log'
		data.method = 'GET'
		return request(data)
	},
	// 获取充值套餐
	http_user_wallet_package(data = {}) {
		data.url = '/api/user.wallet/package'
		data.method = 'GET'
		return request(data)
	},
	// 充值创建订单
	http_user_wallet_create(data = {}) {
		data.url = '/api/user.wallet/create'
		data.method = 'GET'
		return request(data)
	},
	http_user_add_huke_post(data = {}) {
		data.url = '/api/user.add_huke/post'
		return request(data)
	},
	// 获取当前用户已购买当前活动商品的数量
	http_user_seckill_order_getBuyNum(data = {}) {
		data.url = '/api/user.order/getBuyNum'
		data.method = 'GET'
		return request(data)
	},
	// 商家收款
	http_user_smoke_order_create(data = {}) {
		data.url = '/api/user.smoke_order/create'
		return request(data)
	},
	// 积分明细
	http_userIntegrel_details_view(data) {
		return request({
			url: '/api/user.Integrel_details/view',
			data,
			method: 'GET',
		})
	},

}
const goods = {
	// 商品列表
	http_mall_goods_lst(data = {}) {
		data.url = '/api/mall.goods/lst'
		data.method = 'GET'
		data.wrToken = false
		return request(data)
	},
	// 商品详情
	http_goods_details(data = {}) {
		data.url = '/api/mall.goods/view'
		data.method = 'GET'
		// 如果有token就传，没有就不传
		data.wrToken = loginStatus ? true : false
		return request(data)
	},
	// 首页轮播/背景图配置
	http_other_nav_index(data = {}) {
		data.url = '/api/other.nav/index'
		data.wrToken = false
		return request(data)
	},
	// 获取发货仓库列表
	http_otherwarehouse_lst(data = {}) {
		data.url = '/api/other.warehouse/lst'
		data.wrToken = false
		return request(data)
	},
	// 商品分类
	http_mallgoods_cate_lts(data = {}) {
		data.url = '/api/mall.goods_cate/lts'
		data.wrToken = false
		return request(data)
	},
	// 获取门店列表
	http_mall_suppliers_lst(data = {}) {
		data.url = '/api/mall.suppliers/lst'
		data.wrToken = false
		return request(data)
	},
	// 门店详情
	http_mall_suppliers_view(data = {}) {
		data.url = '/api/mall.suppliers/view'
		data.method = 'GET'
		data.wrToken = false
		return request(data)
	},
	// 虎克介绍/加入政策
	http_other_huke_index(data = {}) {
		data.url = '/api/other.huke/index'
		data.method = 'GET'
		data.wrToken = false
		return request(data)
	},
	// 明日之星
	http_other_huke_rising_star_lst(data = {}) {
		data.url = '/api/other.huke/rising_star_lst'
		data.method = 'GET'
		data.wrToken = false
		return request(data)
	},
	// 获取秒杀商品列表
	http_mall_activity_goods_seckill_lts(data = {}) {
		data.url = '/api/mall.activity_goods/lts'
		data.method = 'GET'
		data.wrToken = false
		return request(data)
	},
	// 拼团商品列表
	http_mall_pintuan_goods_lts(data = {}) {
		return request({
			method: 'GET',
			wrToken: false,
			url: '/api/mall.pintuan_goods/lts',
			method: 'GET',
			...data
		})
	},
	// 当前商品正在拼团的用户列表
	http_mallpintuan_goods_wait_lts(data = {}) {
		data.url = '/api/mall.pintuan_goods/wait_lts',
			data.method = 'GET',
			data.wrToken = false
		data.unishow = false
		return request(data)
	},
	// 帮助中心
	http_other_huke_huke_help() {
		return request({
			url: '/api/other.huke/huke_help',
			wrToken:false
		})
	},
	// 获取签到信息
	http_member_is_sign() {
		return request({
			url: '/api/user.sign/member_is_sign',
		})
	},
	// 签到
	http_member_sign_up() {
		return request({
			url: '/api/user.sign/member_sign_up',
		})
	},
	// 积分商城确认订单
	http_user_integral_order_confirm(data) {
		return request({
			url: '/api/user.integral_order/confirm',
			...data
		})
	},
	// 积分商城创建订单(商品)
	http_user_integral_order_create(data) {
		return request({
			url: '/api/user.integral_order/create',
			...data
		})
	},
	  // 积分订单列表  http_user_integral_order_lst(data={}){    return request({      url: '/api/user.integral_order/lst',      data,      method: 'GET',    })  },  // 积分订单详情  http_user_integral_order_view(data={}){    return request({      url: '/api/user.integral_order/view',      ...data,      method: 'GET',    })  },  // 删除积分订单  http_user_integral_order_delete(data={}){    return request({      url: '/api/user.integral_order/delete',      data,      method: 'GET',    })  },  // 积分订单确认收货  http_user_integral_order_receive(data={}){    return request({      url: '/api/user.integral_order/receive',      ...data,      method: 'GET',    })  },
	// 积分卡券创建订单(积分兑换优惠券)
	http_user_integral_coupon_order_create(data={}){
		return request({
		      url: '/api/user.integral_coupon_order/create',
		     data,
		      method: 'GET',
		    })
	}
}


// 我的促销
const my = {
	// 分销码
	code(data = {}) {
		return request({
			url: '/api/user.team/invitation_code'
		})
	},
	// 佣金统计
	invitation_code(data = {}) {
		return request({
			url: '/api/user.team/rebate_total'
		})
	},
	rebate_and_withdraw(data = {}) {
		return request({
			data,
			url: '/api/user.team/rebate_and_withdraw'
		})
	},
	// 我的团队人数 一级人数 二级人数
	friends_total(data = {}) {
		return request({
			data,
			url: '/api/user.team/friends_total'
		})
	},
	// 提现总金额
	withdraw_total(data = {}) { //data没有值就为{}  或者在调用的界面传值为一个{}
		return request({
			data,
			url: '/api/user.wallet/withdraw_total'
		})
	},
	// 获取个人信息
	userInfo(data = {}) { //data没有值就为{}  或者在调用的界面传值为一个{}
		return request({
			data,
			url: '/api/user.info/view'
		})
	},
	// 卡卷管理  领取优惠卷
	receive(data = {}) {
		return request({
			data,
			method: 'get',
			url: '/api/user.coupon/receive'
		})
	},
	lst(data = {}) {
		return request({
			data,
			method: 'get',
			url: '/api/user.coupon/lst'
		})
	},
	friendsList(data = {}) {
		return request({
			data,
			url: '/api/user.team/friends_list'
		})
	},
	// 获取手机验证码
	sendcode(data = {}) {
		return request({
			data,
			method: 'get',
			url: '/api/other.sms/send_code'
		})
	},
	// 申请提现
	withdraw(data = {}) {
		return request({
			data,
			url: '/api/user.wallet/withdraw'
		})
	},
	// 获取付款码
	paymentcode(data = {}) {
		return request({
			data,
			url: '/api/user.team/payment_code'
		})
	},
	// 获取所有的优惠卷/api/mall.coupon/all
	all(data = {}) {
		return request({
			data,
			method: 'get',
			url: '/api/mall.coupon/all'
		})
	},
	// 积分商品列表
	goodslst(data = {}) {
		return request({
			data,
			url: '/api/mall.integral_goods/lst'
		})
	},
	// 兑换商品详情  
	integralgoodsview(data = {}) {
		return request({
			data,
			method: 'get',
			url: '/api/mall.integral_goods/view'
		})
	},
	// 积分卡券订单列表
	integralcouponlst(data = {}) {
		return request({
			data,
			url: '/api/mall.integral_coupon/lst'
		})
	},
	// 会员等级福利
	memberlevel(data = {}) {
		return request({
			data,
			method: 'get',
			url: '/api/user.info/member_level'
		})
	},
	// 会员政策列表
	memberpolicy(data = {}) {
		return request({
			data,
			method: 'get',
			url: '/api/user.info/member_policy'
		})
	},
	// 修改用户信息 
	save(data = {}) {
		return request({
			data,
			method: 'POST',
			url: '/api/user.info/save'
		})
	},
	// 绑定手机号
	mobile(data = {}) {
		return request({
			data,
			method: 'POST',
			url: '/api/user.info/bind_mobile'
		})
	},
}
module.exports = {
	...userApi,
	...goods,
	...my
}
